home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Source Code / C / Games / Pentominoes 2.0 / Shell ƒ / help.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-07-15  |  7.9 KB  |  67 lines  |  [TEXT/MMCC]

  1. #include "help.h"
  2. #include "environment.h"
  3. #include "popup.h"
  4. #include "memory layer.h"
  5. #include "button layer.h"
  6. #include "text layer.h"
  7. #include "program globals.h"
  8. #include "window layer.h"
  9.  
  10. #define DEAD_SPACE_TOP        10
  11. #define DEAD_SPACE_LEFT        10
  12. #define DEAD_SPACE_BOTTOM    5
  13. #define DEAD_SPACE_RIGHT    10
  14. #define    TEXT_RECT_WIDTH        405
  15. #define    TEXT_RECT_HEIGHT    250
  16. #define    BUTTON_WIDTH        80
  17. #define    BUTTON_HEIGHT        17
  18. #define BUTTON_GAP_H        15
  19. #define BUTTON_GAP_V        5
  20.  
  21. #define MAX_MAIN_TOPICS        5
  22. #define    MAX_SUB_TOPICS        6
  23.  
  24. #define MAIN_TOPIC_ID        600
  25. #define POPUP_MENU_ID        100
  26.  
  27. short            gMainTopicShowing;        /* saved in prefs file */
  28. short            gSubTopicShowing;        /* saved in prefs file */
  29.  
  30. static    short            gNumMainTopics;
  31. static    short            gNumSubTopics[MAX_MAIN_TOPICS];
  32. static    Str31            gMainTopicTitle[MAX_MAIN_TOPICS];
  33. static    Rect            gMainTopicRect[MAX_MAIN_TOPICS];
  34. static    Str31            gSubTopicTitle[MAX_MAIN_TOPICS][MAX_SUB_TOPICS];
  35. static    short            gSubTopicID[MAX_MAIN_TOPICS][MAX_SUB_TOPICS];
  36. static    Rect            gTextRect;
  37. static    Handle            gTheText;
  38. static    Handle            gTheStyle;
  39.  
  40. static    Boolean            gSetupDone=FALSE;
  41.  
  42. /*-----------------------------------------------------------------------------------*/
  43. /* internal stuff for help.c                                                         */
  44.  
  45. static    short ParseRawTitle(Str255 theTitle);
  46. static    void GoToPage(WindowRef theWindow, short mainTopic, short subTopic,
  47.                 Boolean updateNow);
  48. static    void GetTextResources(short mainTopic, short subTopic);
  49. static    void DisposeTextResources(void);
  50.  
  51. void SetupTheHelpWindow(WindowRef theWindow)
  52. {
  53.     short            i,j;
  54.     unsigned char    *titleStr="\pHelp";
  55.     Handle            temp;
  56.     short            strID;
  57.     Point            thePoint;
  58.     
  59.     SetWindowMaxDepth(theWindow, 8);
  60.     SetWindowWidth(theWindow, DEAD_SPACE_LEFT+TEXT_RECT_WIDTH+DEAD_SPACE_RIGHT);
  61.     SetWindowHeight(theWindow, BUTTON_GAP_V+DEAD_SPACE_TOP+BUTTON_HEIGHT+TEXT_RECT_HEIGHT+
  62.         DEAD_SPACE_BOTTOM);
  63.     SetWindowAttributes(theWindow, kHasCloseBoxMask+kHasDocumentTitlebarMask);
  64.     thePoint.v=50;
  65.     thePoint.h=6;
  66.     SetWindowTopLeft(theWindow, thePoint);
  67.     SetWindow